package pt.nmfa.peste.session;

import pt.nmfa.peste.entity.*;
import java.util.ArrayList;
import java.util.List;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("deviceHome")
public class DeviceHome extends EntityHome<Device> {

	public void setDeviceDeviceId(Integer id) {
		setId(id);
	}

	public Integer getDeviceDeviceId() {
		return (Integer) getId();
	}

	@Override
	protected Device createInstance() {
		Device device = new Device();
		return device;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
	}

	public boolean isWired() {
		return true;
	}

	public Device getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

	public List<DeviceActions> getDeviceActionses() {
		return getInstance() == null ? null : new ArrayList<DeviceActions>(
				getInstance().getDeviceActionses());
	}

	public List<StatusActions> getStatusActionses() {
		return getInstance() == null ? null : new ArrayList<StatusActions>(
				getInstance().getStatusActionses());
	}

}
